<template>
  <div class="sidebar-list">
    <!-- aside列表 -->
    <SidebarItem v-on="$listeners" @changePage="changePageFn" @deleteCategory="getCategoryList" />
  </div>
</template>

<script>
import SidebarItem from './sidebar-item.vue'
import { mapActions } from 'vuex'
export default {
  name: 'SidebarList',
  components: {
    SidebarItem
  },
  data() {
    return {
      listParams: {
        page: 1,
        limit: 10
      }
    }
  },
  created() {
    this.getCategoryList()
  },
  methods: {
    ...mapActions(['image/getCategoryList']),
    getCategoryList() {
      this['image/getCategoryList'](this.listParams)
    },
    // 分页切换
    changePageFn(val) {
      this.listParams.page += val
      this.getCategoryList()
    }
  }
}
</script>

<style lang="scss" scoped>
.sidebar-list {
  width: 100%;
  height: 100%;
}
</style>
